import { resolve } from 'path';
import dts from 'vite-plugin-dts';
import { defineConfig } from 'vite';

// https://vite.dev/config/
export default defineConfig({
  define: {
    'process.env.NODE_ENV': JSON.stringify('production'),
  },
  plugins: [
    dts({
      rollupTypes: true,
      tsconfigPath: './tsconfig.app.json',
    }),
  ],
  build: {
    lib: {
      entry: {
        'runtime-core': resolve(__dirname, 'lib/index.ts'),
        shared: resolve(__dirname, 'lib/shared.ts'),
        reactivity: resolve(__dirname, 'lib/reactivity.ts'),
      },
      name: 'runtime-core',
      formats: ['es'],
      fileName: (format, entryName) => `${entryName}.${format}.js`,
    },
    sourcemap: true,
  },
});
